export default function ({ state, time = 2000, error = false }) {
  return new Promise((resolve, reject) => {
    setTimeout(() => {
      if (error) {
        reject(state);
      } else {
        resolve(state);
      }
    }, time);
  });
}